﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ATM_Client.Properties;

namespace ATM_Client
{
    public partial class Deposit : Form
    {
        readonly IATM _client = new ATMClient();
        public static string token = "";
        public Deposit()
        {
            InitializeComponent();
            lblBalance.Text = _client.ShowBalance(token);
        }

        private void DepositLoad(object sender, EventArgs e)
        {

        }

        private void BtnDepositClick(object sender, EventArgs e)
        {
            long amount = Convert.ToInt64(txtInput.Text);
            int isSuccess = _client.Deposit(token, amount);
            if (isSuccess == 0)
            {
                MessageBox.Show(Resources.Deposit_BtnDepositClick_Deposit_Successfully__Please_check_your_account_information_);
                ViewBalance.token = token;
                var form = new ViewBalance();
                Dispose();                
                form.Show();
            }            
        }

        private void BtnBackClick(object sender, EventArgs e)
        {
            MainForm.token = token;
            var form = new MainForm();
            form.Show();
            Dispose();
        }
    }
}
